<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>isPromiseLike</title>
</head>

<body>
    <script>
        const isPromiseLike = obj =>
            obj !== null &&
            (typeof obj === 'object' || typeof obj === 'function') &&
            typeof obj.then === 'function';
        document.write(`isPromiseLike({then: function () {return '';}})的结果是:${isPromiseLike({
            then: function () {
                return '';
            }
        })}`)
    </script>
</body>

</html>